#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <cstring>
#include <iomanip>
#include <set>
#include <map>
#include <cstdio>
#define fill(a, c) memset(a, c, sizeof(a))
#define ldb long double
#define LL long long
#define nextLine() {int c = 0; while((c = getchar()) != 10 && c != EOF);}
#define sqr(a) ((a) * (a))
#define debug(a) cerr << #a << " = " << a << " ";
#define debugl(a) cerr << #a << " = " << a << "\n";
const ldb eps = 1e-9;
const ldb LDINF = 1e70;
const LL LINF = 1ll << 60;
const int INF = 1 << 30;
const ldb pi = fabs(atan2(0.0, -1.0));
using namespace std;

int n, k;

int a[100010];
int was[100010];
int res[100010];
int mx[100010];
int cmx[100010];

void Load()
{
	scanf("%d%d", &n, &k);
	int i;
	for (i = 0; i < n; i++)
	{
		scanf("%d", &a[i]);
   	}
}


int Next(int key)
{
	
}

int Update()


void Solve()
{
	int i, j, cnt = 0;
	sort(a, a + n);

	for (i = 0; i < n; i++)
	{
		was[i] = 0;
		if (i > 0 && a[i] != a[i - 1]) cnt = 0;
		cnt++;
		if (cnt > k)
		{
			printf("-1\n");
			return;
		}
	}
	all.erase(all.begin(), all.end());	
	mx[n] = 0;
	cmx[n] = 0;
	cnt = 0;
	for (i = n - 1; i >= 0; i--)
	{
		all[a[i]]++;
		if (i + 1 < n && a[i] != a[i + 1]) cnt = 0;
		cnt++;
		if (mx[i + 1] == cnt)
		{
			mx[i] = cnt;
			cmx[i] = cmx[i + 1] + 1;
		}
		else if (mx[i + 1] > cnt)
		{
			mx[i] = mx[i + 1];
			cmx[i] = cmx[i + 1];
		}
		else 
		{
			mx[i] = cnt;
			cmx[i] = 1;
		}
	}

	int l = -1;
	int lst = 0;
	map <int, int> :: iterator it;
	for (i = 0; i < n; i++)
	{
		if (i % k == 0)
		{
			it = all.begin();
			l++;
		}
		else
		{
			it = all.upper_bound(res[i - 1]);
			l++;
		}

		for (; it != all.end(); it++)
		{
			if ()
		}

		for (; j < n; j++)
		{
			if (was[j])
			{
				if (lst + 1 == j) lst = j;
				continue;
			}
			if (i % k != 0 && res[i - 1] == a[j]) continue;
			if (mx[i + 1] == (n / k - l) && cmx[i + 1] <= (k - (i % k) - 1)
			|| mx[i + 1] < (n / k - l))
			{
				was[j] = 1;
				res[i] = a[j];
				cerr << "pushed to i = " << i << " val " << res[i] << "\n"; 
				break;
			}
		}
	}
	for (i = 0; i < n; i++)
		printf("%d ", res[i]);
}

int main()
{
#ifndef ONLINE_JUDGE
	freopen("in", "rt", stdin);
	freopen("out", "wt", stdout);
#endif
	int t;
	cin >> t;
	int i;
	for (i = 0; i < t; i++)
	{
		Load();
		Solve();
	}
	return 0;
}
